'use strict';

module.exports = app => {
  const { STRING, UUID, NOW, DATE, UUIDV4, INTEGER } = app.Sequelize;

  const cameraVideo = app.model.define('cameraVideo', {
    id: {
      type: UUID,
      primaryKey: true,
      allowNull: false,
      defaultValue: UUIDV4,
    },
    info: {
      type: STRING(200),
      field: 'info',
      comment: '上报信息'
    },
    dts: {
      type: STRING(36),
      field: 'dts',
      comment: '数字时间戳'
    },
    count: {
      type: INTEGER,
      field: 'count',
      comment: '设备计数'
    },
    unitip: {
      type: STRING(36),
      field: 'unitip',
      comment: '设备ip'
    },
    unitname: {
      type: STRING(36),
      field: 'unitname',
      comment: '设备名称'
    },
    datetime: {
      type: DATE,
      comment: '事件发生时间'
    }
  }, {
    timestamps: false,
    // 实例对应的表名    
    tableName: 'camera_video',
  });

  return cameraVideo;

};